nvme_cli/tests: nose2 --verbose --start-dir tests nvme_compare_test" command failed #3061
+3
−3
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Test team tried to run the following command and got the error:
nose2 --verbose --start-dir tests nvme_compare_test
test_write_zeros (nvme_writezeros_test.TestNVMeWriteZeros)
Testcae main ...
Using nvme binary 'nvme'
ERROR
======================================================================
ERROR: test_write_zeros (nvme_writezeros_test.TestNVMeWriteZeros)
Testcae main
Traceback (most recent call last):
File "/home/nvme-cli/tests/nvme_writezeros_test.py", line 52, in setUp
super().setUp()
File "/home/nvme-cli/tests/nvme_test_io.py", line 44, in setUp
super().setUp()
File "/home/nvme-cli/tests/nvme_test.py", line 80, in setUp
self.create_and_attach_default_ns()
File "/home/nvme-cli/tests/nvme_test.py", line 109, in create_and_attach_default_ns
err = self.create_and_validate_ns(self.default_nsid,
File "/home/nvme-cli/tests/nvme_test.py", line 379, in create_and_validate_ns
json_output = json.loads(proc.stdout.read())
File "/usr/lib64/python3.9/json/init.py", line 346, in loads
return _default_decoder.decode(s)
File "/usr/lib64/python3.9/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib64/python3.9/json/decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
Ran 1 test in 0.961s
FAILED (errors=1)
When creating a namespace for the first time, output is text: create-ns: Success, created nsid:1
nvme create-ns /dev/nvme4 --nsze=390703446 --ncap=390703446 --flbas=0 --dps=0 --output-format=json
create-ns: Success, created nsid:1
When creating a namespace for the second time, output is in json format.
nvme create-ns /dev/nvme4 --nsze=390703446 --ncap=390703446 --flbas=0 --dps=0 --output-format=json
{
"status: 8469":[
{
"error":"Namespace Insufficient Capacity: Creating the namespace requires more free space than is currently available",
"type":"nvme"
}
]
}
We hits the ERROR when trying to call " json.loads(proc.stdout.read())." to read text.
So the patch fix the issue: use proc.stdout.read() instead of json.loads(proc.stdout.read()).
Signed-off-by: Wen Xiong[email protected]